package com.cman777.springc.elasticsearch.properties;

import lombok.Getter;
import lombok.Setter;
import org.springframework.boot.context.properties.ConfigurationProperties;

import java.util.ArrayList;
import java.util.List;

/**
 * @author chenzhicong
 * @time 2020/6/10 12:25
 */
@ConfigurationProperties(prefix = "es",ignoreInvalidFields=true)
@Getter
@Setter
public class ESConfigProperties {

    /**
      * 集群连接
      */
    private List<Host> hosts = new ArrayList<>();
    /**
      * 建立连接超时时间
      */
    private  int connectTimeOut = 1000;
    /**
      * 套接字通信超时时间
      */
    private  int socketTimeOut = 30000;
    /**
      * 从连接池获取连接超时时间
      */
    private  int connectionRequestTimeOut = 500;
    /**
      * 最大连接数
      */
    private  int maxConnectNum = 100;
    /**
      * 最大路由连接数
      */
    private  int maxConnectPerRoute = 100;


    @Getter
    @Setter
    public static class Host{
        /**
          * host
          */
        private String host;
        /**
          * 端口
          */
        private Integer port;
        /**
          * 协议 http https
          */
        private String schema;
    }
}
